package org.example;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:何人亮
 * Date:2024-11-10
 * 14:07
 */
class Test{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int[] arr=new int[3];
        for(int i=0;i<3;i++){
            arr[i]=sc.nextInt();
        }
        int min=Math.abs(arr[0]-arr[1])+Math.abs(arr[1]-arr[2]);
        for(int i=-1;i<=1;i++){
            for(int j=-1;j<=1;j++){
                for(int k=-1;k<=1;k++){
                    int n1 =arr[0]+i;
                    int n2 =arr[1]+j;
                    int n3 =arr[2]+k;
                    int sum=Math.abs(n1-n2)+Math.abs(n2-n3);
                    min=Math.min(min,sum);
                }
            }
        }
        System.out.println(min);
    }
}